<?php
include_once('connection/connection.php');
include('report/reportFunctions.php');
include('header.php');
include('menu.php');
include('config.php');
error_reporting(0);
$distId=$_SESSION['district'];
//$sqlReport = "SELECT distinct `district_id`,`district_name`,`block_id`,`block_name` FROM `tbl_lookup_location` where `district_id` = ".$distId." group by `block_id`";
$qr_fact="SELECT population_factor from tbl_lookup_pop_factor where district_id='$distId'";
$res_fact = mysql_query($qr_fact);
$row_fact = mysql_fetch_array($res_fact);
$pop_factor=$row_fact['population_factor'];

$qr2="select * from tbl_dtls_ufw_main where multi_dist_id='$distId'";
//$qr2="select * from tbl_dtls_ufw_main AS m, tbl_lookup_location AS l where m.multi_dist_id='$distId'";
$res2 = mysql_query($qr2);
$row_cnt= mysql_num_rows($res2);
?>
<html>
<head>
<script language="javascript" type="text/javascript" >
function PrintContent()
{
var DocumentContainer = document.getElementById('ufw_div');
var WindowObject = window.open("PrintWindow",width=750,height=650,top=50,left=50,toolbars='no',scrollbars='yes',status='no',resizable='yes');
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.close();
WindowObject.focus();
WindowObject.print();
WindowObject.close();
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<!--<meta http-equiv="Content-Type" content="application/vnd.ms-excel; charset=iso-8859-1"/>-->
<title>RWSS Report</title>
</head>
<body>
<div id="ufw_div" style="width:600px;">
<div align="center">
<form action="" method="post" enctype="multipart/form-data">
<!--Response.ContentType = "application/vnd.ms-excel"-->
<table border="0" width="2420" cellspacing="0" cellpadding="0">
	<tr bgcolor="#E9E9E9">
		<td height="26">
		<p align="center"><span style="font-size: 9pt; font-weight: 700">
		<font face="Verdana" color="#224568">RWSS Report</font></span></p>
        </td>
	</tr>
	<tr bgcolor="#C5D8EB">
		<td height="56">
		<table border="1" width="2420" cellspacing="0" cellpadding="0">
			<tr>
				<td width="31" align="center" rowspan="3">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">S.No.</font></td>
				<td width="46" align="center" rowspan="3">
				<font face="Verdana" style="font-size: 8.5pt" color="#000000">Name of Scheme</font></td>
				<td width="37" align="center" rowspan="3">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">Name of Block</font></td>
				<td width="76" align="center" rowspan="3">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">Name of Source Village</font></td>
				<td width="49" align="center" rowspan="3">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">No. of Villages Covered</font></td>
				<td width="55" align="center" rowspan="3">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">No. of Villages currently supplied to</font></td>
				<td width="111" align="center" rowspan="3">
				<font face="Verdana" style="font-size: 8.5pt" color="#000000">Name of Villages</font></td>
				<td width="114" align="center" rowspan="3">
				<font face="Verdana" style="font-size: 8.5pt" color="#000000">Population(2010)</font></td>
				<td width="106" align="center" rowspan="3">
				<font face="Verdana" style="font-size: 8.5pt" color="#000000">Current Water Demand(KLD)</font></td>
				<td align="center" colspan="12">
				<font face="Verdana" style="font-size: 8.5pt" color="#000000">Performance against design parameters</font></td>
				<td width="132" align="center" rowspan="3">
				<font face="Verdana" style="font-size: 8.5pt" color="#000000">Source Dependendency(%)</font></td>
				<td align="center" colspan="6">
				<font face="Verdana" style="font-size: 8.5pt" color="#000000">Coverage</font></td>
                <td width="51" align="center" rowspan="3">
				<font face="Verdana" style="font-size: 8.5pt" color="#000000">Remarks</font></td>
                <td width="91" align="center" rowspan="3">
				<font face="Verdana" style="font-size: 8.5pt" color="#000000">Specific steps required to improve efficiency to design level</font></td>
            </tr>
			<tr>
				<td align="center" colspan="2">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">Production (KLD)</font></td>
				<td align="center" colspan="2">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">Per capita water supply(lpcd)</font></td>
				<td align="center" colspan="2">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">Duration of Water  Supply (hrs)</font></td>
				<td align="center" colspan="2">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">Residual Pressure (Kg/cm2)</font></td>
				<td align="center" colspan="2">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">UFW (%)</font></td>
				<td align="center" colspan="2">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">Energy Efficiency of pumps(%)</font></td>
				<td align="center" colspan="6">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">Water Supply Level of Villages (% of lpcd)</font>                </td>
			</tr>
			<tr>
				<td width="113" align="center">
			  	<font style="font-size: 8.5pt" face="Verdana" color="#000000">Source</font></td>
				<td width="135" align="center">
			  	<font style="font-size: 8.5pt" face="Verdana" color="#000000">Village Boundary</font></td>
				<td width="128" align="center">
			  	<font style="font-size: 8.5pt" face="Verdana" color="#000000">Design</font></td>
				<td width="116" align="center">
			  	<font style="font-size: 8.5pt" face="Verdana" color="#000000">Actual</font></td>
				<td width="93" align="center">
			  	<font style="font-size: 8.5pt" face="Verdana" color="#000000">Design</font></td>
				<td width="92" align="center">
			  	<font style="font-size: 8.5pt" face="Verdana" color="#000000">Actual</font></td>
				<td width="81" align="center">
			  	<font style="font-size: 8.5pt" face="Verdana" color="#000000">Design</font></td>
				<td width="75" align="center">
			  	<font style="font-size: 8.5pt" face="Verdana" color="#000000">Actual</font></td>
				<td width="39" align="center">
			  	<font style="font-size: 8.5pt" face="Verdana" color="#000000">Design</font></td>
				<td width="35" align="center">
			  	<font style="font-size: 8.5pt" face="Verdana" color="#000000">Actual</font></td>
				<td width="88" align="center">
			  	<font style="font-size: 8.5pt" face="Verdana" color="#000000">Design</font></td>
				<td width="102" align="center">
			  	<font style="font-size: 8.5pt" face="Verdana" color="#000000">Actual</font></td>
				<td width="65" align="center">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">Full (100%)</font></td>
				<td width="63" align="center">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">75% to 99%</font></td>
				<td width="63" align="center">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">50% to 75%</font></td>
				<td width="60" align="center">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">25% to 50%</font></td>
				<td width="78" align="center">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">Below 25%</font></td>
				<td width="33" align="center">
				<font style="font-size: 8.5pt" face="Verdana" color="#000000">None (0%)</font></td>
			</tr>
			<?php
			$slNo = 1;							
			while($row2 = mysql_fetch_array($res2)) 
			{
			//$id=$row2['id'];
			?>
				<tr bgcolor="#F9F9F9" valign="top">
					<td width="31" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $slNo; ?></font></td>
					<td width="46" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $nm_scheme=$row2['name_rwss']; ?></font></td>
					<td width="37" align="center">
						<table border="1" width="" cellspacing="0" cellpadding="0" height="22" bordercolor="#C5D8EB" bgcolor="#F9F9F9">
						<?php
							$blk_id=explode(',',$row2['multi_block_id']);
							$cnt_blk=count($blk_id);
							$vil_id=explode(',',$row2['multi_village_id']);
							$cnt_vil=count($vil_id);
							$total_vil_cover+=$cnt_vil;
							//for($i=1; $i<=$row_cnt; $i++)
							//{
								for($j=0; $j<$cnt_blk; $j++)
								{
						?>
						<tr>
							<td width="" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php $id=$blk_id[$j]; echo getName('block',$id);?></font></td>
						</tr>
						<?php } $id=$row2['id'];?>
				  </table></td>
				  <?php
				  	$qr_src="select village from tbl_dtls_ufw_src_village where district=(select distinct district_name from tbl_lookup_location where district_id='$distId') AND loc_id='$id'";
					$res_src = mysql_query($qr_src);
					//$row_src = mysql_fetch_array($res_src);
				  ?>
				  <td width="76" align="center">
						<table border="1" width="" cellspacing="0" cellpadding="0" height="" bordercolor="#C5D8EB" bgcolor="#F9F9F9">
						<?php
							while($row_src = mysql_fetch_array($res_src)) 
							{ 
							?>
					<tr valign="top">
				  <td width="" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $row_src['village']; ?></font></td>
				  </tr>
						<?php } ?>
				  </table></td>
					<td width="49" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $cnt_vil; ?></font></td>
					<?php 
					$qr="SELECT DISTINCT habit.habit_name FROM tbl_dtls_ufw_main main, tbl_dtls_ufw_habit habit WHERE habit.type_habit='MH' AND habit.status_a_na='Applicable' AND main.id='$id' AND habit.loc_id='$id' AND main.multi_dist_id='$distId' AND main.name_rwss='$nm_scheme'";
					$res= mysql_query($qr);
					//$row = mysql_fetch_array($res);
					$row_cnt= mysql_num_rows($res);
					$total_vil_supply+=$row_cnt;
					?>
					<td width="55" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $row_cnt; ?></font></td>
					<td align="center" colspan="3">
					<table border="1" width="335" cellspacing="0" cellpadding="0" height="" bordercolor="#C5D8EB" bgcolor="#F9F9F9">
					<?php
					$vil_id=explode(',',$row2['multi_village_id']);
					$cnt_vil=count($vil_id);
					for($j=0; $j<$cnt_vil; $j++)
					{
					 $qr_pop="SELECT sum(round(total_population * $pop_factor)) AS total_pop FROM tbl_lookup_location WHERE district_id='$distId' AND village_id=$vil_id[$j]";
					$res_pop = mysql_query($qr_pop);
					?>
					<tr>
					<td width="99" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php $id_vil=$vil_id[$j]; echo getName('village',$id_vil);?></font></td>
					<?php
					while($row_pop = mysql_fetch_array($res_pop))
					{
					?>
					<td width="106" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $popu_2010=$row_pop['total_pop'];?></font></td>
					<?php 
					if($distId == '389' || $distId == '390' || $distId == '391' || $distId == '392' || $distId == '398' || $distId == '401' || $distId == '402' || $distId == '403' || $distId == '404' || $distId == '405' || $distId == '406' || $distId == '416')
						{
							$lpcd=70;
						}
						else
						{
							$lpcd=40;
						}
					$water_demand=($popu_2010 * $lpcd) / 1000;
					?>
					<td width="87" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $water_demand;?></font></td>
					<?php }?>
					</tr>
					<?php } ?>
					</table></td>
					<td width="113" height="28" rowspan="<?php //echo $row3_cnt;?>" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $water_source=$row2['water_source'];?></font></td>
					<td align="center" colspan="3">
				<table border="1" width="383" cellspacing="0" cellpadding="0" height="" bordercolor="#C5D8EB" bgcolor="#F9F9F9">
					<?php
					$total=0;
					for($j=0; $j<$cnt_vil; $j++)
					{
					$qr_pop="SELECT sum(round(total_population * $pop_factor)) AS total_pop FROM tbl_lookup_location WHERE district_id='$distId' AND village_id=$vil_id[$j]";
					$res_pop = mysql_query($qr_pop);
					$row_pop = mysql_fetch_array($res_pop);
					$popu_2010 = $row_pop['total_pop'];
					$qr_bound="SELECT DISTINCT habit.habit_name, sum(habit.water_boundary) AS water_bound FROM tbl_dtls_ufw_main main, tbl_dtls_ufw_habit habit, tbl_lookup_location loc WHERE habit.status_a_na='Applicable' AND main.id='$id' AND habit.loc_id='$id' AND loc.habitation_code=habit.habit_code AND loc.village_id=$vil_id[$j] AND loc.district_id='$distId' AND main.multi_dist_id='$distId' AND main.name_rwss='$nm_scheme'";
					$res_bound= mysql_query($qr_bound);
					while($row_bound = mysql_fetch_array($res_bound)) 
					{ 
						$water_bound = $row_bound['water_bound'];
						$total+=$water_bound;
						$actual_lpcd=(($water_bound * 1000) / $popu_2010);
						$actual_lpcd=number_format($actual_lpcd, 2, '.', '');
						$prcent_lpcd=($actual_lpcd/$lpcd)*100;
					?>
					<tr valign="top">
					<td width="135" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $water_bound ;?></font></td>
					<td width="127" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $lpcd;?></font></td>
			
					<td width="113" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $actual_lpcd;?></font></td>
					</tr>
					<?php } }
					?>
				  </table></td>
				  <?php
				 	 $qr_dur="SELECT DISTINCT pump.type_src, pump.num_hrs FROM tbl_dtls_ufw_main main, tbl_dtls_ufw_inner_pump_detail pump,  tbl_dtls_ufw_src_village src_village WHERE main.id=src_village.loc_id AND main.id=pump.loc_id AND main.multi_dist_id='$distId' AND main.name_rwss='$nm_scheme' AND pump.status_pump='Op'";
					 $res_dur= mysql_query($qr_dur);
					 //$row = mysql_fetch_array($res);
					 $row_cnt_dur = mysql_num_rows($res_dur);
					 
				  ?>
				  <td align="center" colspan="2">
				  <table border="1" width="187" cellspacing="0" cellpadding="0" height="" bordercolor="#C5D8EB" bgcolor="#F9F9F9">
				  <?php
				  if($row_cnt_dur == 0)
				  { ?>
				  	<tr valign="top">
						<td width="93" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo 'NF'; ?></font></td>
					  <td width="88" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo 'NF'; ?></font></td>
					</tr>
				 <?php }	
				 else
				 {
						while($row_dur = mysql_fetch_array($res_dur)) 
						{
					?>
					<tr valign="top">
						<td width="93" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo '8';?></font></td>
					  <td width="88" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $row_dur['num_hrs']; ?></font></td>
					</tr>
					<?php 
						} 
						}
					?>
				 	</table></td>
					 <?php
					$qr_resd="SELECT DISTINCT reserv.type_reserv, reserv.habitation_name, reserv.status_reserv FROM tbl_dtls_ufw_main main, tbl_dtls_ufw_habit habit, tbl_dtls_ufw_reserv_detail reserv WHERE reserv.type_habit='MH' AND reserv.habitation_name=habit.habit_name AND habit.status_a_na='Applicable' AND habit.loc_id='$id' AND reserv.loc_id='$id' AND main.multi_dist_id='$distId' AND main.name_rwss='$nm_scheme'";
					 $res_resd= mysql_query($qr_resd);
					 //$row = mysql_fetch_array($res);
					 $row_cnt_resd= mysql_num_rows($res_resd);
				  ?>
					<td align="center" colspan="2">
					<table border="1" width="153" cellspacing="0" cellpadding="0" height="" bordercolor="#C5D8EB" bgcolor="#F9F9F9">
					<?php
					while($row_resd = mysql_fetch_array($res_resd)) 
					{
					?>
					<tr valign="top">
					<td width="75" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo '7';?></font></td>
					<?php
						if($row_resd['status_reserv']=='Not-in-use/Dry')
						{
							$resdual_actual='0';
						}
						else
						{
							$resdual_actual='7';
						}	
					?>
					<td width="72" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $resdual_actual;?></font></td>
					</tr>
					<?php } 
					$actual_water = $water_source - $total;
					$actual_ufw = ($actual_water / $water_source) * 100;
					$actual_ufw = number_format($actual_ufw, 2, '.', '');
					?>
				  </table></td>
					<td width="39" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo '15';?></font></td>
					<td width="35" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $actual_ufw; ?></font></td>
					<td align="center" colspan="3">
						<table border="1" width="326" cellspacing="0" cellpadding="0" height="" bordercolor="#C5D8EB" bgcolor="#F9F9F9">
						<?php
					$qr5="SELECT DISTINCT pump.head, pump.depth_pump, pump.actual_discharge, pump.current, pump.voltage, pump.power_factor, pump2.depth_gw, pump2.gw_fluctuation FROM tbl_dtls_ufw_main main, tbl_dtls_ufw_inner_pump_detail pump, tbl_dtls_ufw_src_village src_village, tbl_dtls_ufw_pump_detail pump2 WHERE src_village.loc_id='$id' AND pump.loc_id='$id' AND pump2.loc_id='$id' AND main.multi_dist_id='$distId' AND main.name_rwss='$nm_scheme' AND pump.status_pump='Op' AND pump.src_village=pump2.src_village AND pump.type_src=pump2.type_src";
					$res5 = mysql_query($qr5);
					$row_cnt = mysql_num_rows($res5);
				  	if($row_cnt_dur == 0)
				  	{ ?>
						<tr valign="top">
						<td width="88" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo 'NF';?></font></td>
						<td width="102" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo 'NF'; ?></font></td>
				  <td width="128" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo 'NF'; ?></font></td>
				  </tr>

					<?php }
					else
					{
					while($row5 = mysql_fetch_array($res5)) 
					{
						$head=$row5['head'];
						$actual_discharge=$row5['actual_discharge'];
						$current=$row5['current'];
						$voltage=$row5['voltage'];
						$power_factor=$row5['power_factor'];
						$depth_pump=$row5['depth_pump'];
						$actual_power = (1.732 * $voltage * $current * $power_factor) / 1000;
						$actual_efficiency = (($actual_discharge * 1000 * 9.81 * $head) / (3.6 * 1000000 * $actual_power)) * 100;
						$actual_efficiency = number_format($actual_efficiency, 2, '.', '');
						$depth_gw=$row5['depth_gw'];
						$gw_fluctuation=$row5['gw_fluctuation'];
						$src_depend = ($depth_pump - $depth_gw - 6) / $gw_fluctuation;
						$src_depend = ($src_depend / 15) * 100;
						$src_depend = number_format($src_depend, 2, '.', '');
						?>
						<tr valign="top">
						<td width="88" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo '50';?></font></td>
						<td width="102" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $actual_efficiency; ?></font></td>
				  <td width="128" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php if($src_depend < 0){ echo $src_value=0; } else if($src_depend > 100){ echo $src_value=100; } else echo $src_depend; ?></font></td>
				  </tr>
						<?php } } ?>
				  </table></td>
					<td align="center" colspan="6">
					<table border="1" width="372" cellspacing="0" cellpadding="0" height="" bordercolor="#C5D8EB" bgcolor="#F9F9F9">
					<?php
						for($j=0; $j<$cnt_vil; $j++)
						{
							$qr_pop="SELECT sum(round(total_population * $pop_factor)) AS total_pop FROM tbl_lookup_location WHERE district_id='$distId' AND village_id=$vil_id[$j]";
							$res_pop = mysql_query($qr_pop);
							$row_pop = mysql_fetch_array($res_pop);
							$popu_2010 = $row_pop['total_pop'];
							$qr_bound="SELECT DISTINCT habit.habit_name, sum(habit.water_boundary) AS water_bound FROM tbl_dtls_ufw_main main, tbl_dtls_ufw_habit habit, tbl_lookup_location loc WHERE habit.status_a_na='Applicable' AND main.id='$id' AND habit.loc_id='$id' AND loc.habitation_code=habit.habit_code AND loc.village_id=$vil_id[$j] AND loc.district_id='$distId' AND main.multi_dist_id='$distId' AND main.name_rwss='$nm_scheme'";
						$res_bound= mysql_query($qr_bound);
						while($row_bound = mysql_fetch_array($res_bound)) 
						{ 
							$water_bound = $row_bound['water_bound'];
							$total+=$water_bound;
							$actual_lpcd=(($water_bound * 1000) / $popu_2010);
							$actual_lpcd=number_format($actual_lpcd, 2, '.', '');
							$prcent_lpcd=($actual_lpcd/$lpcd)*100;
					?>
					<tr valign="top">
					<td width="62" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php 
						if($prcent_lpcd >= 100 )
						{
							echo $coverage1=1;
						}
						else
						{
							echo $coverage1='';
						}
						$total_cov1+=$coverage1;
					?></font></td>
					<td width="63" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php 
						if(($prcent_lpcd >= 75) && ($prcent_lpcd <= 99))
						{
						echo $coverage2=1;
						}
						else
						{
							echo $coverage2='';
						}
						$total_cov2+=$coverage2;
					?></font></td>
					<td width="63" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php
						if($prcent_lpcd >= 50 &&  $prcent_lpcd < 75)
						{
							echo $coverage3=1;
						}
						else
						{
							echo $coverage3='';
						}
						$total_cov3+=$coverage3;
					?></font></td>
					<td width="62" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php 
						if($prcent_lpcd >= 25 &&  $prcent_lpcd < 50)
						{
							echo $coverage4=1;
						}
						else
						{
							echo $coverage4='';
						}
						$total_cov4+=$coverage4;
					?></font></td>
					<td width="54" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php 
					if($prcent_lpcd < 25 && $prcent_lpcd > 0)
						{
							echo $coverage5=1;
						}
						else
						{
							echo $coverage5='';
						}
						$total_cov5+=$coverage5;
					?></font></td>
					<td width="53" align="center" height="20"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php 
					if($prcent_lpcd == 0)
						{
							echo $coverage6=1;
						}
						else
						{
							echo $coverage6='';
						}
						$total_cov6+=$coverage6;
					?></font></td>
					</tr>
					<?php } } ?>
					</table></td>
					<td width="51" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $row2['remark'];?></font></td>
					<td width="91" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php ?></font></td>
				</tr>
				<?php 
			$slNo++;
			} ?>
			<tr bgcolor="#E9E9E9" align="center">
			<td height="20"></td>
			<td></td>
			<td></td>
			<td><font style="font-size: 8.5pt" face="Verdana" color="#000000">Total</font></td>
			<td><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $total_vil_cover;?></font></td>
			<td><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $total_vil_supply;?></font></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $total_cov1;?></font></td>
			<td><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $total_cov2;?></font></td>
			<td><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $total_cov3;?></font></td>
			<td><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $total_cov4;?></font></td>
			<td><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $total_cov5;?></font></td>
			<td><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $total_cov6;?></font></td>
			<td></td>
			<td></td>
			</tr>
		  </table>
	  </td>		
		</tr>
		<!--<tr><td><font style="font-size: 8.5pt" face="Verdana" color="#000000">*Current water demand </font></td></tr>-->
		<tr><td><a href='' onClick='return PrintContent()'>Print this Report</a></td></tr>
	<tr>
		<td></td>
	</tr>
	
	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
</table>
</form>		
</div>
</div>	
</body>
</html>
